// CameraDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CameraDlg.h"
#include ".\cameradlg.h"


// CCameraDlg dialog

IMPLEMENT_DYNAMIC(CCameraDlg, CDialog)
CCameraDlg::CCameraDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCameraDlg::IDD, pParent)
{
}

CCameraDlg::~CCameraDlg()
{
}

BOOL CCameraDlg::OnInitDialog()
{
	__super::OnInitDialog();

	for (int i = 0; i < 3; i++)
	{
		m_oCameraPos[i].SetRange(-500, 500, TRUE);
		m_oLookAtPos[i].SetRange(-500, 500, TRUE);
	}
	//m_oCameraPos[0].SetScrollPos(SB_HORZ, 0);
	//m_oCameraPos[1].SetScrollPos(SB_HORZ, 0);
	//m_oCameraPos[2].SetScrollPos(SB_HORZ, 500);

	m_oCameraPos[0].SetPos(0);
	m_oCameraPos[1].SetPos(0);
	m_oCameraPos[2].SetPos(500);

	//m_oLookAtPos[0].SetScrollPos(SB_HORZ, 0);
	//m_oLookAtPos[1].SetScrollPos(SB_HORZ, 0);
	//m_oLookAtPos[2].SetScrollPos(SB_HORZ, 0);

	m_oLookAtPos[0].SetPos(0);
	m_oLookAtPos[1].SetPos(0);
	m_oLookAtPos[2].SetPos(0);

	return TRUE;
}

void CCameraDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_SLIDER_CAMPOS_X, m_oCameraPos[0]);
	DDX_Control(pDX, IDC_SLIDER_CAMPOS_Y, m_oCameraPos[1]);
	DDX_Control(pDX, IDC_SLIDER_CAMPOS_Z, m_oCameraPos[2]);
	DDX_Control(pDX, IDC_SLIDER_LOOKAT_X, m_oLookAtPos[0]);
	DDX_Control(pDX, IDC_SLIDER_LOOKAT_Y, m_oLookAtPos[1]);
	DDX_Control(pDX, IDC_SLIDER_LOOKAT_Z, m_oLookAtPos[2]);
}

BEGIN_MESSAGE_MAP(CCameraDlg, CDialog)
	ON_NOTIFY_RANGE(NM_CUSTOMDRAW, IDC_SLIDER_CAMPOS_X, IDC_SLIDER_LOOKAT_Z, OnSliderNotify)
END_MESSAGE_MAP()


// CCameraDlg message handlers

void CCameraDlg::OnSliderNotify(UINT nID, NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
	// TODO: Add your control notification handler code here
	*pResult = 0;
}
